import request from '../utils/request'

// 学生登录
export function studentLogin(stuNo, password) {
  return request({
    url: '/student-user/login',
    method: 'post',
    params: { stuNo, password }
  })
}

// 获取学生个人信息
export function getStudentInfo(studentId) {
  return request({
    url: `/student-user/info/${studentId}`,
    method: 'get'
  })
}

// 更新学生个人信息
export function updateStudentInfo(student) {
  return request({
    url: '/student-user/update',
    method: 'put',
    data: student
  })
}

// 获取学生课表
export function getStudentSchedule(studentId, semester) {
  return request({
    url: `/student-user/schedule/${studentId}`,
    method: 'get',
    params: { semester }
  })
}

// 获取学生本周课表
export function getStudentWeekSchedule(studentId, semester, weekNo) {
  return request({
    url: `/student-user/schedule/week/${studentId}/${semester}/${weekNo}`,
    method: 'get'
  })
}

// 获取学生今日课表
export function getStudentTodaySchedule(studentId, semester, weekNo, dayOfWeek) {
  return request({
    url: `/student-user/schedule/today/${studentId}/${semester}/${weekNo}/${dayOfWeek}`,
    method: 'get'
  })
}

// 获取可选课程列表
export function getAvailableCourses(studentId, semester) {
  return request({
    url: `/student-user/courses/available/${studentId}/${semester}`,
    method: 'get'
  })
}

// 学生选课
export function selectCourse(studentId, courseId, semester) {
  return request({
    url: '/student-user/course/select',
    method: 'post',
    params: {
      studentId,
      courseId,
      semester
    }
  })
}

// 学生退课
export function dropCourse(studentId, courseId) {
  return request({
    url: '/student-user/course/drop',
    method: 'post',
    params: { 
      studentId,
      courseId
    }
  })
}

// 获取学生已选课程
export function getSelectedCourses(studentId, semester) {
  return request({
    url: `/student-user/courses/selected/${studentId}/${semester}`,
    method: 'get'
  })
}

// 获取学生成绩
export function getStudentGrades(studentId, semester) {
  return request({
    url: `/student-user/grades/${studentId}/${semester}`,
    method: 'get'
  })
}

// 获取学生学分统计
export function getStudentCreditStats(studentId) {
  return request({
    url: `/student-user/credits/${studentId}`,
    method: 'get'
  })
}

// 获取课程提醒
export function getCourseReminders(studentId, semester) {
  return request({
    url: `/student-user/reminders/${studentId}`,
    method: 'get',
    params: { semester }
  })
}

// 获取学习通知列表
export function getStudentNotices(studentId, semester) {
  return request({
    url: `/student-user/notices/${studentId}`,
    method: 'get',
    params: { semester }
  })
}

// 标记通知为已读
export function markNoticeRead(studentId, noticeId) {
  return request({
    url: '/student-user/notices/read',
    method: 'post',
    params: {
      studentId,
      noticeId
    }
  })
}










